package com.tcc.fastline.Fragments.Factory;

import java.util.HashMap;

import com.tcc.fastline.Fragments.CadastroEstabelecimentoFragment;
import com.tcc.fastline.Fragments.CadastroNewUserFragment;
import com.tcc.fastline.Fragments.ConsultaEstabelecimentoFragment;
import com.tcc.fastline.Fragments.ConsultaUsuarioFragment;
import com.tcc.fastline.Fragments.ConteudoFragment;
import com.tcc.fastline.Fragments.EntrarFilaFragment;
import com.tcc.fastline.Fragments.EstabelecimentoViewFragment;
import com.tcc.fastline.Fragments.FilasUsuarioFragment;
import com.tcc.fastline.Fragments.GerenciarFilaFragment;
import com.tcc.fastline.Fragments.Inicio;
import com.tcc.fastline.Fragments.LoginFragment;
import com.tcc.fastline.Fragments.PerfilEstabelecimentoFragment;
import com.tcc.fastline.Fragments.PerfilUsuarioFragment;
import com.tcc.fastline.Fragments.RelatorioEstabelecimentoFragment;
import com.tcc.smartqueue.R;

public class FragmentFactory {

	private static HashMap<Integer, ConteudoFragment> catalogoViews;

	public static void CarregarCatalago() {
		catalogoViews = new HashMap<Integer, ConteudoFragment>();
		catalogoViews.put(R.layout.inicio, new Inicio());
		catalogoViews.put(R.layout.login_fragment_main, new LoginFragment());
		catalogoViews.put(R.layout.cadastro_new_user_fragment, new CadastroNewUserFragment());
		catalogoViews.put(R.layout.cadastro_estabelecimento, new CadastroEstabelecimentoFragment());
		catalogoViews.put(R.layout.consulta_usuario_fragment, new ConsultaUsuarioFragment());
		catalogoViews.put(R.layout.perfil_estabelecimento, new PerfilEstabelecimentoFragment());
		catalogoViews.put(R.layout.perfil_usuario, new PerfilUsuarioFragment());
		catalogoViews.put(R.layout.consulta_estabelecimento_fragment, new ConsultaEstabelecimentoFragment());
		catalogoViews.put(R.layout.estabelecimento_view, new EstabelecimentoViewFragment());
		catalogoViews.put(R.layout.entrar_fila, new EntrarFilaFragment());
		catalogoViews.put(R.layout.relatorio_estabelecimento, new RelatorioEstabelecimentoFragment());
		catalogoViews.put(R.layout.filas_usuario, new FilasUsuarioFragment());
		catalogoViews.put(R.layout.gerenciar_fila, new GerenciarFilaFragment());
	}

	public static ConteudoFragment getFragment(int layout) {

		if (catalogoViews != null && catalogoViews.containsKey(layout)) {

			ConteudoFragment conteudo = (ConteudoFragment) catalogoViews.get(layout);
			
			return conteudo.newInstance();
		}

		return null;
	}
}
